using AiQiuQuan.Sport.Model.Models;
using AiQiuQuan.Sport.Core;
using AiQiuQuan.Sport.WebApi.Services;
using Microsoft.AspNetCore.Mvc;

namespace AiQiuQuan.Sport.WebApi.Controllers
{
    /// <summary>
    /// 平台场馆订单管理
    /// </summary>
    public class PlatformVenueOrderController : PcApiController
    {
        private readonly IVenueOrderService _venueOrderService;

        /// <summary>
        /// cotr
        /// </summary>
        public PlatformVenueOrderController(
            IVenueOrderService venueOrderService)
        {
            _venueOrderService = venueOrderService;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="id">订单ID</param>
        [HttpGet("get")]
        public async Task<UnaryResult<SiteOrderDto>> GetAsync(Guid id)
        {
            var result = await _venueOrderService.GetAsync(id);
            return UnaryResult.Succeed(result);
        }

        /// <summary>
        /// 分页请求
        /// </summary>
        [HttpPost("pagelist")]
        public async Task<UnaryResult<PageResult<SiteOrderDto>>> PageListAsync(VenueOrderPageRequestDto request)
        {
            var result = await _venueOrderService.PageListAsync(request);
            return UnaryResult.Succeed(result);
        }
    }
}
